<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAddressTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_address', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->string('addr_consignee',30)->comment('收货人姓名');
            $table->char('addr_tel',11)->comment('收货人电话');
            $table->string('addr_province',30)->comment('省');
            $table->string('addr_city',30)->comment('市');
            $table->string('addr_county',30)->comment('县');
            $table->string('addr_detail',200)->comment('详细地址');
            $table->string('addr_postcode',10)->comment('邮编');
            $table->tinyInteger('addr_status')->default(0)->comment('状态 1 为默认');
            $table->index('user_id');
            $table->index('addr_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_address');
    }
}
